import type { ValueLabelType } from '@/constants';
import { Select } from 'antd';

const { Option } = Select;

type Props = {
  options: ValueLabelType[];
  value?: string | number;
  onChange?: (value: string | number) => void;
  [key: string]: any;
};

const MSelect: React.FC<Props> = ({ options, value, onChange, ...rest }) => {
  return (
    <Select value={value} onChange={onChange} placeholder="请选择" {...rest}>
      {options.map((option) => (
        <Option key={option.value} value={option.value}>
          {option.label || option.text}
        </Option>
      ))}
    </Select>
  );
};

export default MSelect;
